﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonEmpManual.aspx.cs"
    Inherits="RN.ERP.Web.Person.PersonEmpManual" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>
        <%=PageTitle %></title>
    <link href="../Styles/skins/blue/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/skins/blue/css/style_msg.css" rel="stylesheet" type="text/css" />
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <script src="../Scripts/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" src="../Scripts/json-data.js"></script>
    <script type="text/javascript" src="../Scripts/iepngfix_tilebg.js"></script>
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script src="../Scripts/PsnEmpInfoSelect.js" type="text/javascript"></script>
    <style type="text/css">
        .IE6png
        {
            behavior: url("../Scripts/iepngfix.htc");
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <input id="hdStatus" type="hidden" runat="server" value="0" />
      <input id="hdAreaCode" type="hidden" runat="server" value="" />
       <input type="hidden" id="hdCorpGuid" runat="server" value=""/>
    <table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
            <td width="16" class="title_lbg IE6png">
            </td>
            <td width="24" class="title_t IE6png">
            </td>
            <td width="713" class="title_libg IE6png">
                人员执业手册
            </td>
            <td width="17" class="title_rbg IE6png">
            </td>
        </tr>
        <tr>
            <td class="border_lbg IE6png">
                &nbsp;
            </td>
            <td colspan="2">
                <div id="con">
                    <ul id="tags">
                        <li class="selectTag"><a href="javascript:void(0)">专业证书</a> </li>
                    </ul>
                    <div id="tagContent">
                        <div class="tagContent selectTag" id="empTitleDetails" table="tb_emp_titledetails"
                            valtype="1">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="xx_tab">
                                <tr>
                                    <td width="67" align="right">
                                        证书类别
                                        <input id="hdManualID" type="hidden" runat="server" value="" control="StampCode" />
                                        <input id="hdEmpGuid" type="hidden" runat="server" value="" control="EmpGuid" />
                                        <input id="hdEducationGUID" type="hidden" runat="server" value="" control="EducationGUID" />
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                    <select name="" id="selCertificateName" runat="server" style="width: 205px; height: 20px;
                                                        line-height: 31px; margin-top: 5px; border: 0;" controltype="drop" control="TypeFlags,CertificateName"
                                                        controlvalid="SelEmpty(this,'-1')" controltext="证书类别">
                                                        <option value="-1" vls='-1'>请选择</option>
                                                    </select>
                                                </span><span class="input_r">
                                                    <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                        </div>
                                    </td>
                                    <td width="67" align="right">
                                        专业
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                    <select name="" id="selCSCode" runat="server" style="width: 205px; height: 20px;
                                                        line-height: 31px; margin-top: 5px; border: 0;" controltype="drop" control="CertificateSpecialty,CSCode"
                                                        controlvalid="SelEmpty(this,'-1')" controltext="专业">
                                                        <option value="-1" vls='-1'>请选择</option>
                                                    </select>
                                                </span><span class="input_r">
                                                    <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="67" align="right">
                                        证书等级
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                    <select name="" id="selCLCode" runat="server" style="width: 205px; height: 20px;
                                                        line-height: 31px; margin-top: 5px; border: 0;" controltype="drop" control="CertificateLevel,CLCode">
                                                        <option value="-1" vls='-1'>请选择</option>
                                                    </select>
                                                </span><span class="input_r">
                                                    <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                        </div>
                                    </td>
                                    <td width="67" align="right">
                                        证书编号
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                    <input name="text" id="txtCertificateCode" runat="server" type="text" value="" style="width: 275px;
                                                        height: 31px; line-height: 31px; border: 0; background: transparent" control="CertificateCode"
                                                        maxlength="50" controlvalid="checkEmpty(this,'')" controltext="注册编号" /></span>
                                            <span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="67" align="right">
                                        签发日期
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                    <input name="text" id="txtGetCertificateDate" runat="server" type="text" value=""
                                                        style="width: 275px; height: 31px; line-height: 31px; border: 0; background: transparent"
                                                        onclick="WdatePicker({skin:'blue',maxDate:'%y-%M-%d'})" control="GetCertificateDate"
                                                        maxlength="10" controlvalid="checkEmpty(this,'')" controltext="签发日期" /></span>
                                            <span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                        </div>
                                    </td>
                                    <td width="67" align="right">
                                        有效期至
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                    <input name="text" type="text" value="" style="width: 275px; height: 31px; line-height: 31px;
                                                        border: 0; background: transparent; overflow: hidden" onclick="WdatePicker({skin:'blue',minDate:'%y-%M-{%d+1}'})"
                                                        control="ZsEndDate" id="txtZsEndDate" runat="server" maxlength="10" />
                                                </span><span class="input_r">
                                                    <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="67" align="right" valign="top">
                                        上传证书
                                    </td>
                                    <td align="left" colspan="3">
                                        <div runat="server" id="certImgDiv">
                                            <a href="javascript:void(0);" id="certImgUpload">
                                                <img alt="上传" src="../images/btn.jpg" /></a>
                                        </div>
                                        <div>
                                            <img src='' id="certimg" alt="" style="display: none; width: 220px; height: 150px;"
                                                class="pointer" />
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <table height="80" border="0" align="center" cellpadding="0" cellspacing="0" runat="server"
                                id="btnSaveDiv" class="xx_tab">
                                <tr>
                                    <td width="144" height="80">
                                        <div class="icon01 IE6png">
                                            <a id="btnSave" parentdiv="empTitleDetails" href="javascript:void(0);">保存</a></div>
                                    </td>
                                    <td width="11" height="80">
                                        &nbsp;
                                    </td>
                                    <td width="144" height="80">
                                        <div class="icon02 IE6png">
                                            <a id="btnCancel" href="javascript:void(0);">关闭</a></div>
                                    </td>
                                </tr>
                            </table>
                       
                        </div>
                             <!--#修改日志-->
                            <div id="shenhe" runat="server" visible="false">
                                <div class="xian">
                                    <div class="about_title">
                                        信息审核</div>
                                </div>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="xx_tab">
                                    <tr>
                                        <td align="right">
                                            审核结果
                                            <input id="hdID" type="hidden" runat="server" value="0" control="ID" />
                                        </td>
                                        <td>
                                            <div class="s_input">
                                                <span class="input_l">
                                                    <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                                        <select id="DropAudit" style="width: 205px; height: 20px; line-height: 31px; margin-top: 5px;
                                                            border: 0;">
                                                            <option value="5">通过</option>
                                                            <option value="6">退回</option>
                                                        </select></span> <span class="input_r">
                                                            <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            审核意见
                                        </td>
                                        <td>
                                            <div class="text_input">
                                                <span class="input_l">
                                                    <img src="../images/text_l.jpg" width="10" height="81" alt="" /></span> <span class="text_m">
                                                        <textarea id="txtContext" cols="220" rows="4" style="width: 628px; height: 70px;
                                                            margin-top: 5px; border: 0;"></textarea>
                                                    </span><span class="input_r">
                                                        <img src="../images/text_r.jpg" width="10" height="81" alt="" /></span>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                <table height="80" border="0" align="center" cellpadding="0" cellspacing="0" class="xx_tab">
                                    <tr>
                                        <td width="144" height="80">
                                            <div class="icon01 IE6png">
                                                <a id="btnShSave" href="javascript:void(0);">保存</a>
                                            </div>
                                        </td>
                                        <%-- <td width="11" height="80">&nbsp;</td>
                                    <td width="144" height="80">
                                        <div class="icon02 IE6png">
                                            <a id="btnCancel" href="javascript:void(0);">关闭</a>
                                        </div>
                                    </td>--%>
                                    </tr>
                                </table>
                            </div>
                            <!--#修改日志结束-->
                    </div>
                </div>
            </td>
            <td class="border_rbg IE6png">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="border_lconer IE6png" headers="17">
                &nbsp;
            </td>
            <td colspan="2" class="border_bottomli IE6png" height="17">
                &nbsp;
            </td>
            <td class="border_rconer IE6png" headers="17">
                &nbsp;
            </td>
        </tr>
    </table>
    <div id="ImgDialog" style="margin: auto; width: 600px;">
        <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadWindowManager ID="Manager1" runat="server" EnableShadow="true" Skin="WebBlue">
            <Windows>
                <telerik:RadWindow ID="RadW1" runat="server" Title="" Height="280px" Behaviors="Close"
                    Width="550px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Skin="WebBlue" VisibleStatusbar="False">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </div>
    </form>
</body>
</html>
<script type="text/javascript">
    var empGuid;
    var status;
    var educationGUID;
    var editStatus;
    var manualID;
    /*人员审核退回*/
    var optType;
    var corpGuid;
    var areaCode;
    var descr;
    var cartGuid;
    $(function () {
        manualID = $("#<%= hdManualID.ClientID%>").val();
        empGuid = $("#<%= hdEmpGuid.ClientID%>").val();
        status = $("#<%= hdStatus.ClientID%>").val();
        educationGUID = $("#<%= hdEducationGUID.ClientID%>").val();
        Certificate = "<%=selCertificateName.ClientID %>";
        CSCode = "<%=selCSCode.ClientID %>";
        CLCode = "<%=selCLCode.ClientID %>";
        editStatus = "<%=EditStatus %>";
        optType = 5;
        corpGuid = $("#<%=hdCorpGuid.ClientID %>").val();
        areaCode = $("#<%=hdAreaCode.ClientID %>").val();
        cartGuid = $("#<%=hdEducationGUID.ClientID %>").val();
        empCertType = manualID; //执业手册标识
        Initial();
        SetControlEditById(editStatus, "empTitleDetails"); //控件编辑状态设置
    });
    /*初始化页面*/
    function Initial() {
        descr = "";
        $("#btnSave").click(function () {
            EmpTitleDetailsSave("btnSave");
        });
        $("#btnCancel").click(function () {
            returnToParent(1);
        });
        //图片上传begin
        $("#certImgUpload").click(function () {
            if (empGuid == "") {
                OpenAlert("请先添加人员信息！");
                return false;
            }
            $.ligerDialog.open({ url: "../UserControl/FileUploadList.aspx?filename=" + educationGUID + "&FuncCode=PersonZG", width: 650, height: 570, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            return false;
        });
        //end
        //证书类别begin
        $("#" + Certificate).change(function () {
            SelCertChange();
        });
        //end
        if (status == "1") {
            GetQualities();
            ImgShow1();
        } else {
            if (manualID != "") {
                SelCertAll(manualID, 0, Certificate, "-1", "-1"); //证书类别
            }
        }
        $("#btnShSave").click(function () {
            CheckAudit();
        });
    }
    /*取得信息**/
    function GetQualities() {
        $.getJSON("PersonEmpCertInfo.aspx", { "action": "GetQualities", "empGuid": empGuid, "certGuid": educationGUID, "rand": Math.random() }, function (data) {
            if (data.length == 0 || data == null) {
                OpenAlert("未查询到有效数据！");
                return false;
            }
            if (data.result == 1) {
                OpenAlert(data.message);
                return false;
            }
            var items = data.data;

            if (items != null) {
                SetControlVal("empTitleDetails", items); //页面控件赋值
                level = items.CertificateLevel;
                specil = items.CertificateSpecialty;
                SelCertAll(manualID, 0, Certificate, items.TypeFlags, "-1"); //下拉列表赋值

            }
        });
    }
    /*保存信息*/
    function EmpTitleDetailsSave(btnId) {
        if (empGuid == "") {
            OpenAlert("请先添加人员信息！");
            return false;
        }
        //验证控件值
        var dataValid = CheckControlValid(btnId);
        if (!dataValid) {
            return false;
        }
        $("#" + btnId).attr("disabled", "disabled");
        if (status == "0") {
            EmpTitleDetailsAdd(btnId, "QualitieAdd");
        } else {
            EmpTitleDetailsAdd(btnId, "QualitieEdit");
        }
    }
    /*添加修改信息*/
    function EmpTitleDetailsAdd(btnId, action) {
        var dataStr = GetData(btnId); //取得页面上的输入值
        $.getJSON("PersonEmpCertInfo.aspx", { "action": action, "empGuid": empGuid, "data": dataStr, "rand": Math.random() }, function (data) {
            $("#" + btnId).removeAttr("disabled");
            OpenAlert(data.Message);
            if (data.Result) {
                returnToParent(0);
            }
        });
    }
    /*关闭子窗口执行事件*/
    function OnClientCloseImg(args) {
        var arg = args;
        if (arg) {
            if (arg.Result == 1) {
                return;
            }
            ImgShow1();
        }
    }
    /*加载图片*/
    function ImgShow1() {
        $("#certimg").attr("src", "../Handlers/GetFileHandler.ashx?fileName=" + educationGUID + ".jpg&sysCode=EF&funcCode=PersonZG&rand=" + Math.random());
        $("#certimg").click(function () {
            top.$.ligerDialog.open({ url: "Enterprise/UploadFileShowList.aspx?fileName=" + educationGUID + "&fileType=.jpg&sysCode=EF&funcCode=PersonZG", width: 820, height: 650, title: '', isResize: true, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            return false;
        });
        $("#certimg").show();
    }
    /*关闭窗口*/
    function returnToParent(result) {
        var oArg = new Object();
        oArg.childWinName = "CertSC";
        oArg.Result = result;
        //        top.ChildDialogCallBack = "OnClientClose";
        //        top.ChildDialogClose(oArg);
        parent.window.OnClientClose(oArg);
        window.parent.$.ligerDialog.close(); ////关闭dialog
        parent.$(".l-dialog,.l-window-mask").hide(); ////去除父窗体遮罩层
        parent.window.focus();
    }
    function OpenAlert(text) {
        $.ligerDialog.warn(text);
        return false;
    }
    function OpenConfirm(text, confirmCallBackFn) {
        $.ligerDialog.confirm(text, '', confirmCallBackFn);
        return false;
    }
</script>
<script type="text/javascript">
  //审核
    function CheckAudit() {
        if ($("#txtContext").val() == "") {
            OpenAlert("请添加审核意见！");
            $("#txtContext").focus();
            return false;
        }
        if ($("#txtContext").val().length > 200) {
            OpenAlert("审核意见内容过长！");
            $("#txtContext").select();
            return false;
        }
        optType = $("#DropAudit").val();
        var obj = GetMessage(opt);
        message = obj.message;
        OpenConfirm(obj.tootip, confirmCallBackFnAudit);
        return false;
      
    }
    //审核执行事件
    function confirmCallBackFnAudit(arg) {
        if (arg) {
            var parmer = {};
            parmer.action = "Audit";
            parmer.empGuid = empGuid;
            parmer.certGuid = cartGuid;
            //parmer.areaCode = areaCode;
            parmer.message = message;
            parmer.optType = optType;
            parmer.descr = $("#txtContext").val();
            parmer.rand = Math.random();
           
            $.getJSON("PersonEmpManual.aspx", parmer, function (data) {
                OpenAlert(data.Message);
//                if (data.Result) {
//                    returnToParent(0);
//                }
            });
        }
    }
   
</script>
